<template>
  <div id="app">
    <h1 v-text="msg" ref="title"></h1>
    <button ref="btn" @click="showDom">点我输出上方dom元素</button>
    <School ref="sch"></School>
  </div>
</template>

<script>
import School from "./components/School";

export default {
  name: "App",
  components: {
    School,
  },
  data() {
    return {
      msg: "你好同学",
    };
  },
  methods:{
    showDom(){
      console.log(this.$refs.title); //真是DOM元素
      console.log(this.$refs.btn); //真是DOM元素
      console.log(this.$refs.sch); // school组件的实例对象
    }
  }
};
</script>
